<!DOCTYPE html>
<html>
<head>
    <title>Events</title>

    <link href="../../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../../styles/kendo.default.min.css" rel="stylesheet">

    <script src="../../../js/jquery.min.js"></script>
    <script src="../../../js/kendo.web.min.js"></script>
    <script src="../../content/shared/js/console.js"></script>
</head>
<body>
    <a class="offline-button" href="../index.html">Back</a>
    
        <div id="example" class="k-content">
            <input id="input"/>
            <script>
                $(document).ready(function() {
                    function onOpen() {
                        if ("kendoConsole" in window) {
                            kendoConsole.log("event: open");
                        }
                    }

                    function onClose() {
                        if ("kendoConsole" in window) {
                            kendoConsole.log("event: close");
                        }
                    }

                    function onChange() {
                        if ("kendoConsole" in window) {
                            kendoConsole.log("event: change");
                        }
                    }

                    function onSelect(e) {
                        if ("kendoConsole" in window) {
                            var dataItem = this.dataItem(e.item.index());
                            kendoConsole.log("event :: select (" + dataItem.text + " : " + dataItem.value + ")" );
                        }
                    };

                    var data = [
                        { text: "Item 1", value:"1" },
                        { text: "Item 2", value:"2" },
                        { text: "Item 3", value:"3" }
                    ];

                    $("#input").kendoComboBox({
                        dataTextField: "text",
                        dataValueField: "value",
                        dataSource: data,
                        select: onSelect,
                        change: onChange,
                        close: onClose,
                        open: onOpen
                    });
                });
            </script>
        </div>
        <div class="console"></div>

</body>
</html>
